package com.menghanjun.mhjresourcesharing.utils;

import lombok.Data;

/**
 * 响应封装类
 * @param <T>
 */
@Data
public class JsonResponseBody<T> {
    private int code;
    private String msg;
    private T data;
    private long total;

    public JsonResponseBody(){
        this.code=JsonResponseStatus.SUCCESS.getCode();
        this.msg=JsonResponseStatus.SUCCESS.getMsg();
    }

    public JsonResponseBody(JsonResponseStatus jsonResponseStatus){
        this.code=jsonResponseStatus.getCode();
        this.msg=jsonResponseStatus.getMsg();
    }


    public JsonResponseBody(JsonResponseStatus jsonResponseStatus,T data){
        this.code=jsonResponseStatus.getCode();
        this.msg=jsonResponseStatus.getMsg();
        this.data=data;
    }

    public JsonResponseBody(T data){
        this.code=JsonResponseStatus.SUCCESS.getCode();
        this.msg=JsonResponseStatus.SUCCESS.getMsg();
        this.data=data;
    }

    public JsonResponseBody(T data,long total){
        this.code=JsonResponseStatus.SUCCESS.getCode();
        this.msg=JsonResponseStatus.SUCCESS.getMsg();
        this.data=data;
        this.total=total;
    }
}
